package com.sample.snl.frontend.SyntaxAnalysis;

public class Node {
    private Node[] children;
    private String value;

    public Node(String value) {
        this.value = value;
    }

    public Node[] getChildren() {
        return children;
    }

    public String getValue() {
        return value;
    }

    public void setChildren(Node[] children) {
        this.children = children;
    }

    private boolean printed;

    int x, y, width, length;

    private Node(Node[] children, String value) {
        this.children = children;
        setValue(value);
    }

    boolean hasChild() {
        if (children == null) return false;
        for (Node n : children)
            if (n != null)
                return true;
        return false;
    }

    boolean hasChildNotPrinted() {
        if (children == null) return false;
        for (Node n : children)
            if (n != null)
                if (!n.printed)
                    return true;
        return false;
    }


    public void setValue(String value) {
        this.value = value;
        width = value.length();
    }


    public void setPrinted(boolean printed) {
        this.printed = printed;
    }

    @Override
    public String toString() {
        return "[TreeNode value=" + value + "]";
    }


    public void setX(int X) {
        x = X;
    }

    public int getX() {
        return x;
    }

    public void setY(int Y) {
        y = Y;
    }

    public int getY() {
        return y;
    }

    public void setWidth(int Width) {
        width = Width;
    }

    public int getWidth() {
        return width;
    }

    public void setLength(int Length) {
        length = Length;
    }

    public int getLength() {
        return length;
    }
}
